import 'package:ceramics/util/ab_value_converter.dart';
import 'package:get/get.dart';

class ABOAuthResponse {
  var aaa = 0;
  var isFirstRegister = false;
  var token = '';
  var userInfo = ABUser();

  static ABOAuthResponse fromJson(Map<String,dynamic> json) {
    var response = ABOAuthResponse();
    response.aaa = valueToInt(json['aaa']);
    response.isFirstRegister = valueToBool(json['isFirstRegister']);
    response.token = valueToString(json['token']);
    response.userInfo = ABUser.fromJson(json['userInfo']);
    return response;
  }

  Map<String,dynamic> toJson() {
    var json = <String,dynamic>{};
    json['aaa'] = aaa;
    json['isFirstRegister'] = isFirstRegister;
    json['token'] = token;
    json['userInfo'] = userInfo.toJson();
    return json;
  }
}

class ABUser {
  var age = 0;
  var auditStatus = 0;
  var availableCoins = 0.obs;
  var avatar = '';
  var avatarMiddleThumbUrl = '';
  var avatarStatus = 0;
  var avatarThumbUrl = '';
  var avatarUrl = '';
  var birthday = '';
  var country = '';
  var createTime = 0;
  var followNum = 0;
  var gender = 0;
  var giftWallAction = 0;
  var hasEquity = false;
  var isAnswer = false;
  var isBlock = false;
  var isHavePassword = false;
  var isInternal = false;
  var isMultiple = false;
  var isRecharge = false;
  var isReview = false;
  var isSwitchNotDisturbCall = false;
  var isSwitchNotDisturbIm = false;
  var isVip = false;
  var level = 0;
  var loginPkgName = '';
  var nickname = '';
  var praiseNum = 0;
  var registerCountry = '';
  var registerPkgName = '';
  var userId = '';
  var userType = 0;

  static ABUser fromJson(Map<String,dynamic> json) {
    var user = ABUser();
    user.age = valueToInt(json['age']);
    user.auditStatus = valueToInt(json['auditStatus']);
    user.availableCoins.value = valueToInt(json['availableCoins']);
    user.avatar = valueToString(json['avatar']);
    user.avatarMiddleThumbUrl = valueToString(json['avatarMiddleThumbUrl']);
    user.avatarStatus = valueToInt(json['avatarStatus']);
    user.avatarThumbUrl = valueToString(json['avatarThumbUrl']);
    user.avatarUrl = valueToString(json['avatarUrl']);
    user.birthday = valueToString(json['birthday']);
    user.country = valueToString(json['country']);
    user.createTime = valueToInt(json['createTime']);
    user.followNum = valueToInt(json['followNum']);
    user.gender = valueToInt(json['gender']);
    user.giftWallAction = valueToInt(json['giftWallAction']);
    user.hasEquity = valueToBool(json['hasEquity']);
    user.isAnswer = valueToBool(json['isAnswer']);
    user.isBlock = valueToBool(json['isBlock']);
    user.isHavePassword = valueToBool(json['isHavePassword']);
    user.isInternal = valueToBool(json['isInternal']);
    user.isMultiple = valueToBool(json['isMultiple']);
    user.isRecharge = valueToBool(json['isRecharge']);
    user.isReview = valueToBool(json['isReview']);
    user.isSwitchNotDisturbCall = valueToBool(json['isSwitchNotDisturbCall']);
    user.isSwitchNotDisturbIm = valueToBool(json['isSwitchNotDisturbIm']);
    user.isVip = valueToBool(json['isVip']);
    user.level = valueToInt(json['level']);
    user.loginPkgName = valueToString(json['loginPkgName']);
    user.nickname = valueToString(json['nickname']);
    user.praiseNum = valueToInt(json['praiseNum']);
    user.registerCountry = valueToString(json['registerCountry']);
    user.registerPkgName = valueToString(json['registerPkgName']);
    user.userId = valueToString(json['userId']);
    user.userType = valueToInt(json['userType']);
    return user;
  }

  ABUser copyWith(ABUser user) {
    age = user.age;
    auditStatus = user.auditStatus;
    availableCoins = user.availableCoins;
    avatar = user.avatar;
    avatarMiddleThumbUrl = user.avatarMiddleThumbUrl;
    avatarStatus = user.avatarStatus;
    avatarThumbUrl = user.avatarThumbUrl;
    avatarUrl = user.avatarUrl;
    birthday = user.birthday;
    country = user.country;
    createTime = user.createTime;
    followNum = user.followNum;
    gender = user.gender;
    giftWallAction = user.giftWallAction;
    hasEquity = user.hasEquity;
    isAnswer = user.isAnswer;
    isBlock = user.isBlock;
    isHavePassword = user.isHavePassword;
    isInternal = user.isInternal;
    isMultiple = user.isMultiple;
    isRecharge = user.isRecharge;
    isReview = user.isReview;
    isSwitchNotDisturbCall = user.isSwitchNotDisturbCall;
    isSwitchNotDisturbIm = user.isSwitchNotDisturbIm;
    isVip = user.isVip;
    level = user.level;
    loginPkgName = user.loginPkgName;
    nickname = user.nickname;
    praiseNum = user.praiseNum;
    registerCountry = user.registerCountry;
    registerPkgName = user.registerPkgName;
    userId = user.userId;
    userType = user.userType;
    return this;
  }

  Map<String, dynamic> toJson() {
  return {
    'age': age,
    'auditStatus': auditStatus,
    'availableCoins': availableCoins.value,
    'avatar': avatar,
    'avatarMiddleThumbUrl': avatarMiddleThumbUrl,
    'avatarStatus': avatarStatus,
    'avatarThumbUrl': avatarThumbUrl,
    'avatarUrl': avatarUrl,
    'birthday': birthday,
    'country': country,
    'createTime': createTime,
    'followNum': followNum,
    'gender': gender,
    'giftWallAction': giftWallAction,
    'hasEquity': hasEquity,
    'isAnswer': isAnswer,
    'isBlock': isBlock,
    'isHavePassword': isHavePassword,
    'isInternal': isInternal,
    'isMultiple': isMultiple,
    'isRecharge': isRecharge,
    'isReview': isReview,
    'isSwitchNotDisturbCall': isSwitchNotDisturbCall,
    'isSwitchNotDisturbIm': isSwitchNotDisturbIm,
    'isVip': isVip,
    'level': level,
    'loginPkgName': loginPkgName,
    'nickname': nickname,
    'praiseNum': praiseNum,
    'registerCountry': registerCountry,
    'registerPkgName': registerPkgName,
    'userId': userId,
    'userType': userType,
    };
  }
}